(Pick attack type based on four different levels of charging.  If firing
 Bazooka, either decrement ammo count, or switch to Bazooka bludgeon attack
 if the chosen ammo is gone.)

90/82D8: A4 4C        LDY $4C
90/82DA: BE 60 00     LDX $0060,Y    (get pointer to potential attacker's stats)
90/82DD: B9 2E 00     LDA $002E,Y    (get potential attacker's current charge value.
                                      this is obvious enough on the boy and dog with
                                      their gauges, though i'm not sure how it works
                                      with enemies.)
90/82E0: C9 00 04     CMP #$0400
90/82E3: 90 25        BCC UnderLevel1  (branch if meter < 100%)
90/82E5: C9 00 08     CMP #$0800
90/82E8: 90 1A        BCC Level1       (branch if meter at least 100%, but not yet
                                        a full thin bar)
90/82EA: C9 00 0C     CMP #$0C00

90/82ED: B9 14 00     LDA $0014,Y
90/82F0: 09 00 02     ORA #$0200
90/82F3: 99 14 00     STA $0014,Y     (???)

90/82F6: 90 06        BCC Level2      (branch if at least a full thin bar, but not
                                       yet a full thick bar)

90/82F8: BF 3E 00 8E  LDA $8E003E,X   (attack to do if charged to level 3)
90/82FC: 80 10        BRA $830E

Level2:
90/82FE: BF 3C 00 8E  LDA $8E003C,X   (attack to do if charged to level 2)
90/8302: 80 0A        BRA $830E

Level1:
90/8304: BF 3A 00 8E  LDA $8E003A,X   (attack to do if 100% charged)
90/8308: 80 04        BRA $830E

UnderLevel1:
90/830A: BF 38 00 8E  LDA $8E0038,X   (attack to do if < 100% charged)
90/830E: F0 45        BEQ Exit        (if the attack is null, just exit.  probably
                                       just a possibility for enemies.)

90/8310: C9 FA 41     CMP #$41FA
90/8313: B0 25        BCS Skip       (branch if attack type >= 41FAh)
90/8315: C9 CA 41     CMP #$41CA
90/8318: 90 20        BCC Skip       (branch if attack type < 41CAh)

                                     (attack types seem to be spaced 10h apart,
                                      so the above is effectively branching if the
                                      attack type isn't 41CAh [Thunder Ball shot],
                                      41DAh [Particle Bomb shot], or 41EAh
                                      [Cryo-Blast shot].)

90/831A: 48           PHA            (save attack type)

90/831B: AD 49 23     LDA $2349      (get ammunition type of currently chosen
                                      shell.  0 = Thunder Ball, 2 = Particle Bomb,
                                      4 = Cryo Blast.)
90/831E: 29 FE 00     AND #$00FE
90/8321: 4A           LSR
90/8322: AA           TAX            (now it's 0 = Thunder Ball,
                                      1 = Particle Bomb, 2 = Cryo Blast)
90/8323: BD 45 23     LDA $2345,X
90/8326: 29 FF 00     AND #$00FF     (get ammunition count)
90/8329: D0 06        BNE NotEmpty   (branch if we have some left)

90/832B: 68           PLA
90/832C: A9 EE 3E     LDA #$3EEE
90/832F: 80 09        BRA Skip       (if there's none left, use the bazooka
                                      bludgeon attack instead.  this should
                                      match whatever value was in $8E0038,X
                                      above.)

NotEmpty:
90/8331: E2 20        SEP #$20
90/8333: 3A           DEC
90/8334: 9D 45 23     STA $2345,X    (decrement ammunition count)
90/8337: C2 30        REP #$30

90/8339: 68           PLA            (restore attack type)

Skip:
90/833A: AA           TAX
90/833B: BF 02 00 C4  LDA $C40002,X
90/833F: 89 00 40     BIT #$4000
90/8342: F0 0E        BEQ $8352
90/8344: 86 12        STX $12
90/8346: BE 22 00     LDX $0022,Y
90/8349: BF 5B 81 90  LDA $90815B,X
90/834D: 99 22 00     STA $0022,Y
90/8350: A6 12        LDX $12
90/8352: 4C 1B 81     JMP $811B

Exit:
90/8355: 6B           RTL


(4 freed bytes)

90/8356: EA           NOP
90/8357: EA           NOP
90/8358: EA           NOP
90/8359: 6B           RTL   (keep an RTL here, just in case)

